/**
 * Created by zhiliang.han on 2016/10/26.
 */
$(document).ready(function () {
        $('.son_ul').hide(); //锟斤拷始ul锟斤拷锟斤拷
        $('.select_box span').live('click',function () { //锟斤拷锟斤拷贫锟斤拷锟斤拷锟?
                $(this).parent().css({"zIndex":"555"})
                $(this).parent().find('ul.son_ul').slideDown();  //锟揭碉拷ul.son_ul锟斤拷示
                $(this).parent().find('li').hover(function () {
                    $(this).addClass('hover')
                }, function () {
                    $(this).removeClass('hover')
                }); //li锟斤拷hover效锟斤拷
                $(this).parent().hover(function () {
                    },
                    function () {
                        $(this).parent().find("ul.son_ul").slideUp(10);
                        $(this).parent().find("li.select_box").css({"zIndex":"0"})
                    }
                );
            }
        );
        $('ul.son_ul li').live('click',function () {
            $(this).parents('.selectWrap li').find('span').html($(this).html());
            $(this).parents('.selectWrap li').find('ul').slideUp(10);
            $(this).parents('.selectWrap li').css({"zIndex":"0"});
        });



    $(".nav-wrapper .head .schoolZP ul li:odd,.nav-wrapper .head .personal ul li:odd").css({"background":"#f9f9f9"})
    $(".indexBtm dl:odd,.sz_search .category dl:odd").css({"float":"right"})
    $(".nav-wrapper .head .schoolZP,.nav-wrapper .head .personal").hover(function(e){
        e.stopPropagation();
        $(this).find("ul").show();
        $(this).find("span").attr("id","triangle-up");

    },function(){
        $(this).find("ul").hide();
        $(this).find("span").attr("class","triangle-down");
    });

    $(".suspend a").hover(function(){
        $(this).find("span").show();
    },function(){
        $(this).find("span").hide();
    });

//    radio选锟斤拷
    $('.radio label').click(function () {
        var radioId = $(this).attr('name');
        $('.radio label').removeAttr('class') && $(this).attr('class', 'checked');
        $('input[type="radio"]').removeAttr('checked') && $('#' + radioId).attr('checked', 'checked');
        console.log(radioId+$('#' + radioId).attr('checked'));        
    });


//  锟截碉拷锟斤拷锟斤拷
    $(window).scroll(function(){
        if ($(window).scrollTop()>700){
            $(".suspend .backTop").fadeIn();
        }
        else
        {
            $(".suspend .backTop").fadeOut();
        }
    });


    $(".backTop").click(function(){
        $('body,html').animate({scrollTop:0},0);
        return false;
    });

	$(".suspend").show();
	$(".suspend .backTop").hide();
    var windowW =$(window).width(),imgH = $;
    var windowW =1920,imgH = 381;
    var rightNavBarTop = imgH * windowW/windowW+100;
    $("#rightNavBar").css({"top": rightNavBarTop});
    var oTop = rightNavBarTop;
    //console.log('otop'+oTop);
    var sTop = 0;
    $(window).scroll(function(){
        sTop = $(this).scrollTop();
        //console.log(sTop);
        if(sTop >= oTop){
            $("#rightNavBar").css({"position":"fixed"});
			$("#rightNavBar").stop();
 			$("#rightNavBar").animate({top:"20px"});

        }else{
            $("#rightNavBar").css({"position":"fixed"});
			$("#rightNavBar").stop();
 			$("#rightNavBar").animate({top:oTop});
        }
    });

});